package org.dromara.knowledgebase.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.knowledgebase.core.document.BaseDocument;
import org.dromara.knowledgebase.constant.DocField;
import org.springframework.data.elasticsearch.annotations.*;

@Data
@EqualsAndHashCode(callSuper = true)
@Document(indexName = DocField.INDEX_NAME)
@Setting(
    shards = 5, replicas = 0,
    sortFields = {DocField.SORT_FIELD},
    sortOrders = {Setting.SortOrder.desc}

)
@Routing(DocField.ROUTE_FIELD)
public class Knowledge extends BaseDocument {

    /**
     * 小标题
     */
    @Field(type = FieldType.Text)
    private String subTitle;

    /**
     * 来源
     */
    @Field(type = FieldType.Keyword)
    private String source;

    /**
     * 作者
     */
    @Field(type = FieldType.Text)
    private String author;

    /**
     * 概述[机器]
     */
    @Field(type = FieldType.Text)
    private String summary;

    /**
     * 种类
     */
    @Field(type = FieldType.Keyword)
    private String[] category;

    /**
     * 类型
     */
    @Field(type = FieldType.Keyword)
    private String type;

    /**
     * 链接
     */
    @Field(type = FieldType.Keyword)
    private String url;

    /**
     * 关键词[机器]
     */
    @Field(type = FieldType.Keyword)
    private String[] keywords;

    /**
     * 标签[人工]
     */
    @Field(type = FieldType.Keyword)
    private String[] tags;

    /**
     * 0 HTML, 1 MARKDOWN
     */
    @Field(type = FieldType.Integer)
    private Integer formattedType;

    /**
     * 格式化的内容
     */
    @Field(index=false, type = FieldType.Text)
    private String formattedContent;

    /**
     * 纯文本内容
     */
    @Field(type = FieldType.Text)
    private String pureTextContent;

    /**
     * 实体[机器]
     */
    @Field(type = FieldType.Keyword)
    private String[] entity;
}
